package com.xinhua.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinhua.dao.SsmpMapper;
import com.xinhua.domain.Ssmp;
import com.xinhua.service.SsmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SsmpServiceImpl implements SsmpService {

    @Autowired(required = false)
    private SsmpMapper ssmpMapper;

    @Override
    public Boolean save(Ssmp ssmp) {
        return ssmpMapper.insert(ssmp) > 0;
    }

    @Override
    public Boolean update(Ssmp ssmp) {
        return ssmpMapper.updateById(ssmp) > 0;
    }

    @Override
    public Boolean delete(Integer id) {
        return ssmpMapper.deleteById(id)>0;
    }

    @Override
    public Ssmp getById(Integer id) {
        return ssmpMapper.selectById(id);
    }

    @Override
    public List<Ssmp> getAll() {
        return ssmpMapper.selectList(null);
    }

    @Override
    public IPage<Ssmp> getPage(int currentPage, int PageSize) {
        IPage page=new Page(currentPage,PageSize);
        return ssmpMapper.selectPage(page,null);
    }
}
